<html>
<head><meta charset="utf-8"><title>Compile rustc against llvm master · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html">Compile rustc against llvm master</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239691049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239691049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239691049">(May 21 2021 at 03:21)</a>:</h4>
<p>I'm new to hacking on the Rust compiler so perhaps this is an easy question: Is there a way to compile rustc with llvm master? There's an optimization patch that's in llvm master that I'd like to try out.</p>



<a name="239691439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239691439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239691439">(May 21 2021 at 03:28)</a>:</h4>
<p>I think <a href="https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html#feature-updates">https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html#feature-updates</a> is what I'm supposed to do (except presumably just doing everything locally), but I'm not sure how to do step 2. Like, is there a list of patches I need to apply?<br>
I also don't know if it's even reasonable, if LLVM has broken any APIs or something in their main branch.</p>



<a name="239693477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239693477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239693477">(May 21 2021 at 04:04)</a>:</h4>
<p><span class="user-mention" data-user-id="414202">@fpgaminer</span> if you just want to compile it locally, you can check out the exact commit you want from <code>src/llvm-project</code></p>



<a name="239693504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239693504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239693504">(May 21 2021 at 04:04)</a>:</h4>
<p>so something like <code>cd src/llvm-project; git remote add upstream http://whatever.llvm.uses; git fetch upstream; git checkout some_commit_hash</code></p>



<a name="239693690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239693690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239693690">(May 21 2021 at 04:07)</a>:</h4>
<p>Cool, I'll give it a try. Thank you :)</p>



<a name="239694342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239694342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239694342">(May 21 2021 at 04:18)</a>:</h4>
<p>Hmm, <code>x.py</code> keeps checking out the old version...</p>



<a name="239694972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239694972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239694972">(May 21 2021 at 04:28)</a>:</h4>
<p>Alright, set build.submodules to false, let's see if that does the trick.</p>



<a name="239698947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239698947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fpgaminer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239698947">(May 21 2021 at 05:34)</a>:</h4>
<p>Hmm, nah API isn't compatible with llvm:HEAD. Oh well.</p>



<a name="239718208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239718208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239718208">(May 21 2021 at 08:58)</a>:</h4>
<p>you could try cherry-picking the patch you want to test</p>



<a name="239722073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compile%20rustc%20against%20llvm%20master/near/239722073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compile.20rustc.20against.20llvm.20master.html#239722073">(May 21 2021 at 09:32)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/85416">#85416</a>, waiting for bors, makes some adjustment to keep things working against LLVM main branch.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>